package builders;

import backbone.IBuildable;
import backbone.IUpdatable;
import force.GlobalForce;
import main.Simulation;

/**
 * Adds each global force to the required instance variable
 * in simulation
 * @author Paul
 * @author Lance
 *
 */
public abstract class GlobalForceBuilder implements IBuildable {

    /**
     * Since a GlobalForce is necessarily both updatable and
     * a GlobalForce, it must be added to a Simulation in the 
     * correct place. This method does just that. 
     * 
     * @param sim The simulation to which the GlobalForce is to
     * be added.
     * @param force The force to add to the specified simulation.
     */
    public void addForces(Simulation sim, GlobalForce force) {
        sim.addGlobalForce(force);
        sim.addUpdatable((IUpdatable) force);
    }
}
